// a type implements an interface by implementing its methods and fields
// no explicit declaration of intent, no `implements` keyword
// an interface can have a mut: section, implementing types will need to have a mut receiver

// implementing interface Foo should be: `pub fn (s Type) write(a string) string`
pub interface Foo {
	write(string) string
}


// implementing interface Bar should be: `pub fn (mut s Type) write(a string) string`
pub interface Bar {
mut:
	write(string) string
}

struct MyStruct {}

// MyStruct implements the interface Foo, but *not* interface Bar
pub fn (s MyStruct) write(a string) string {
	return a
}

fn main() {
	s1 := MyStruct{}
	fn1(s1)
	// fn2(s1) -> compile error, since MyStruct does not implement Bar
}

fn fn1(s Foo) {
	println(s.write('Foo'))
}

// fn fn2(s Bar) {
//      println(s.write('Foo'))
// }
